package com.mytest.leetcode;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Solution387 {

    public static void main(String[] args) {
        Solution387 solution704 = new Solution387();
        log.info("{}", solution704.firstUniqChar("aabb"));
    }


    public int firstUniqChar(String s) {


        int length = s.length();
        String append ="";
        for(int i=0;i< length;i++) {
            char ss = s.charAt(i);
            if(append.contains(ss+"")) {
                continue;
            }
            if(!s.substring(i+1, length).contains(ss+"")) {
                return i;
            }else{
                append = ss+""+append;
            }
        }
        return  -1;
    }
}
